//
//  ZYProposealCell.m
//  BestLearning
//
//  Created by Ethan on 2017/9/27.
//  Copyright © 2017年 apple. All rights reserved.
//

#import "ZYProposealCell.h"

@implementation ZYProposealCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self setUpSuperView];
        self.mm = 1;
    }
    
    
    return self;
    
    
}



- (void)setUpSuperView{
    
    
    self.teachLabel = [UILabel new];
//    self.teachLabel.backgroundColor = [UIColor redColor];
    [self.contentView addSubview:self.teachLabel];
    
    self.teachDetal = [UILabel new];
//    self.teachDetal.backgroundColor = [UIColor orangeColor];
    self.teachDetal.numberOfLines = 0;
    [self.contentView addSubview:self.teachDetal];
    
    self.chiLabel = [UILabel new];
//    self.chiLabel.backgroundColor = [UIColor purpleColor];
    [self.contentView addSubview:self.chiLabel];
    self.contentLabel = [UILabel new];
    self.contentLabel.backgroundColor = [UIColor redColor];
    self.contentLabel.numberOfLines = 0;
    [self.contentView addSubview:self.contentLabel];
    
    self.proposealTextView = [UITextView new];
    self.proposealTextView.layer.borderColor = ColorRGB(204, 204, 204).CGColor;
    self.proposealTextView.layer.borderWidth = 1;
    [self.contentView addSubview:self.proposealTextView];
    
    self.submitButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
    self.submitButton.backgroundColor = ColorRGB(204, 204, 204);
    [self.submitButton setTitle:@"提交" forState:(UIControlStateNormal)];
    [self.submitButton setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
    self.submitButton.layer.cornerRadius = 5;
    self.submitButton.clipsToBounds = YES;
    [self.contentView addSubview:self.submitButton];
    
    
    self.teachLabel.text = @"老师建议：";
    [self.teachLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(8);
        make.top.offset(8);
    }];
    
    self.teachDetal.text = @"舍利子, 是诸法空相, 不生不灭, 不垢不净, 不增不减";
    [self.teachDetal mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(15);
        make.top.equalTo(self.teachLabel.mas_bottom).offset(8);
        make.right.equalTo(self).offset(-15);
    }];
    
    self.chiLabel.text = @"家长和孩子意见：";
    [self.chiLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.teachLabel);
        make.top.equalTo(self.teachDetal.mas_bottom).offset(8);
    }];
    
    
    
    
   
    
    if (1==self.mm) {
        
        self.contentLabel.text = @"舍利子, 是诸法空相, 不生不灭, 不垢不净, 不增不减";
        [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.teachDetal);
            make.top.equalTo(self.chiLabel.mas_bottom).offset(8);
        }];
        
        
        
        [self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.offset(0);
            make.bottom.mas_equalTo(self.contentLabel).offset(8);
        }];
        
        
    }else{
        
        [self.proposealTextView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.teachDetal);
            make.top.equalTo(self.chiLabel.mas_bottom).offset(8);
            make.right.equalTo(self).offset(-15);
            make.height.offset(50);
        }];
        
        
        [self.submitButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.offset(20);
            make.top.equalTo(self.proposealTextView.mas_bottom).offset(20);
            make.width.offset(kScreenWidth - 40);
            make.height.offset(30);
        }];
        
        [self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.offset(0);
            make.bottom.mas_equalTo(self.submitButton).offset(8);
        }];
    }
    
    
    
    
    
 
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
}




@end
